package cn.smbms.service.provider;

import cn.smbms.dao.provider.ProviderMapper;
import cn.smbms.pojo.Provider;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProviderServiceImpl implements ProviderService{

    @Resource
    private ProviderMapper providerMapper;

    @Override
    public int getProviderCount(String proCode, String proName) {
        return providerMapper.getProviderCount(proCode, proName);
    }

    @Override
    public List<Provider> getProviderList(String proCode, String proName, Integer startIndex, Integer pageSize) {
        return providerMapper.getProviderList(proCode, proName, (startIndex-1)*pageSize, pageSize);
    }

    @Override
    public boolean addProvider(Provider provider) {
        return providerMapper.addProvider(provider)>0;
    }

    @Override
    public Provider getProviderById(Integer id) {
        return providerMapper.getProviderById(id);
    }

    @Override
    public boolean modfiyProvider(Provider provider) {
        return providerMapper.modfiyProvider(provider)>0;
    }
}
